package com.work.count.pojo;


/**
 * @author ex_renbaokun
 */
public class ResultEntity {
    /**
    * 返回code
    */
    private Integer code;

    /**
    * 返回信息
    */
    private String msg;

    private Object detailData;

    public Object getDetailData() {
        return detailData;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }


    public ResultEntity(){

    }

    public ResultEntity(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultEntity(Integer code, String msg, Object detailData) {
        this.code = code;
        this.msg = msg;
        this.detailData = detailData;
    }


   /**
    * 无分页且有数据返回
    *
    * @param code
	 * @param msg
	 * @param detailData
    * @return com.ansheng.api.vo.ResultEntity
    * @author ex_renbaokun
    * @date  15:50
    */
   public static ResultEntity success(Integer code,String msg,Object detailData){
       if (null == code){
           code = 200;
       }
       if (null == msg){
           msg = "数据查询成功";
       }
        return new ResultEntity(code,msg,detailData);
   }

   /**
    * 无数据返回
    *
    * @param code
	 * @param msg
    * @return com.ansheng.api.vo.ResultEntity
    * @author ex_renbaokun
    * @date  15:51
    */
   public static ResultEntity success(Integer code,String msg){
       code = null == code ? 200 : code;
       msg = null == msg ? "数据查询成功" : msg;
       return new ResultEntity(code,msg);
   }

   /**
    * 系统异常时返回
    *
    * @param code
	 * @param msg
    * @return com.ansheng.api.vo.ResultEntity
    * @author ex_renbaokun
    * @date  15:52
    */
   public static ResultEntity failed(int code,String msg){
       return new ResultEntity(code,msg);
   }
}
